#include <iostream>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
       #include <unistd.h>

void handlerSig(int sig)
{
    std::cout << "获得的一个信号：" << sig << std::endl;
}
int main()
{
    signal(SIGINT, handlerSig);
    int cnt = 0;
    while(true)
    {
        std::cout << "hello, world," << cnt << ", pid" << getpid() << std::endl;
        cnt++;
        sleep(1);
    }
    return 0;
}
